package com.luyuan.wxapp.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.luyuan.common.annotation.Anonymous;
import com.luyuan.common.core.domain.AjaxResult;
import com.luyuan.gallery.domain.ExhiArtwork;
import com.luyuan.gallery.service.IExhiArtworkService;
import com.luyuan.gallery.vo.ExhiArtworkVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.luyuan.common.core.page.TableDataInfo;

/**
 * 作品Controller
 * 
 * @author luyuan
 * @date 2025-11-13
 */
@Api(value = "微信小程序作品接口", tags = "wx_artwork")
@RestController
@RequestMapping("/wxapp/artwork")
public class WxappExhiArtworkController extends WxBaseController {
    @Autowired
    private IExhiArtworkService exhiArtworkService;

    /**
     * 查询作品列表
     */
    @ApiOperation(value = "获取作品列表", notes = "获取作品列表", nickname = "getArtworkList")
    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(ExhiArtwork exhiArtwork) {
        startPage();
        List<ExhiArtworkVO> list = exhiArtworkService.selectExhiArtworkList(exhiArtwork);
        return getDataTable(list);
    }

    /**
     * 获取作品详细信息
     */
    @ApiOperation(value = "获取作品详细信息", notes = "获取作品详细信息", nickname = "getArtworkInfo")
    @Anonymous
    @GetMapping(value = "/{artworkId}")
    public AjaxResult getInfo(@PathVariable("artworkId") Long artworkId) {
        return success(exhiArtworkService.selectExhiArtworkByArtworkId(artworkId));
    }
}
